Javascript Node.js code to resolve incidents

So the purpose of my application is to pull a table check it. If anything goes under violation it grabs the job grabs the id sends it out to pager duty, pager duty responds with the incident number, the job holds that and stores in the table, and it keeps checking and pulling and when it ever stops being in violation grabs the id and goes back to pagerduty and says it is resolved now, and resolves the pagerduty incident.

Right now I am stuck on when these rows on the table ever stop being in violation grabs the id and goes to pagerduty and updates it to resolve. How would i do this if anyone has any ideas. This is written in javascript node.js.

Hi Josh,

Thank you for reaching out to us! You can accomplish your auto-resolve by sending a resolve event at the appropriate time. The payload for resolving an open incident must include the event_type resolve and pass a matching deduplication key as the trigger event for the deduplication/resolve to work.

If you are unable to pass a dedup key with your original event, you can extract one after the event has been sent using our Dynamic Field Enrichment and Extraction feature (while ensuring you pass the same data that this key is derived from in the resolve events you send). I hope that makes sense.

If you have any further questions, please don’t hesitate to reach out. You can also reach out to us for direct help at support@pagerduty.com.

Cheers,